set updatetime=100
if !has('nvim')
let g:go_auto_sameids = 0
let g:go_auto_type_info = 0
let g:go_def_mapping_enabled = 0
let g:go_def_mode='gopls'
let g:go_diagnostics_level = 2
let g:go_doc_balloon = 1
let g:go_doc_keywordprg_enabled = 0
let g:go_doc_popup_window = 0
let g:go_echo_command_info = 0
let g:go_echo_go_info = 1
let g:go_fmt_command = "goimports"
let g:go_fmt_fail_silently = 1
let g:go_gocode_propose_builtins = 0
let g:go_gocode_propose_source = 0
let g:go_gocode_socket_type = 'unix'
let g:go_gocode_unimported_packages = 0
let g:go_highlight_extra_types = 1
let g:go_highlight_function_calls = 1
let g:go_highlight_functions = 1
let g:go_highlight_operators = 1
let g:go_highlight_types = 1
let g:go_info_mode='gopls'
let g:go_list_autoclose = 1
let g:go_term_enabled = 1
endif

if has('nvim')
lua <<EOF
local format_sync_grp = vim.api.nvim_create_augroup("GoFormat", {})
vim.api.nvim_create_autocmd("BufWritePre", {
  pattern = "*.go",
  callback = function()
   require('go.format').goimport()
  end,
  group = format_sync_grp,
})

require('go').setup()
EOF
endif
